<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
/*
	选择卡券modal，通过访问此页面选择获取指定卡券id
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
	//会员列表
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$return['params']=$params=array();
	$params=array('uniacid'=>$_SESSION['uniacid']);
	$fields=array('title');
	if($_RQ['find']){
		$field=in_array($_RQ['field'],$fields)?$_RQ['field']:'title';
		$params[$field.' like']='%'.$_RQ['find'].'%';
		$return['params']['find']=$_RQ['find'];
		$return['params']['field']=$field;
	}
	$list=pdo_getslice('jy_jd_hotel',$params,array($pindex,$psize),$total,array('id','title','image','address','mid'),'','id desc');
	foreach($list as &$item){
			$room=pdo_get('jy_jd_room',array('hotelid'=>$item['id']));
			$item['price']=$room['price'];
			if($_RQ['op']=='many' || $_RQ['getinfo']){
				$item['res']=array(
					'title'=>$item['title'],
					'id'=>$item['id'],
					'image'=>tomedia($item['image']),
					'price'=>$item['price'],
				);
			}else{
				$item['res']=$item['id'];
			}
	}
	$return['list']=$list;
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$return['htmls']=array(
		'type'=>'list',
		'list'=>array('data'=>'list','del_one'=>false,'delall'=>false,'edit'=>false,'list'=>array(
		    array('name'=>'id','title'=>'酒店id','type'=>'string'),
			array('name'=>'image','title'=>'酒店图片','type'=>'image'),
			array('name'=>'title','title'=>'酒店名称','type'=>'string'),
			array('name'=>'price','title'=>'价格','type'=>'string'),
		),'action'=>array(
			array('type'=>'modal_result','name'=>'res','title'=>'选取'),
		)),
		'search_one'=>array('name'=>'find','select_name'=>'field','select_title'=>'筛选','is_radio'=>true,'options'=>'fields'),
	);
	$return['fields']=array(
		'title'=>'酒店名称',
	);
	exi($return);

?>